<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>档案管理系统</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

    <link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/static/dist/css/font-awesome.min.css">
    <link rel="stylesheet" href="/static/dist/css/ionicons.min.css">
    <link rel="stylesheet" href="/static/dist/css/AdminLTE.min.css">
    <link rel="stylesheet" href="/static/dist/css/skins/all-skins.min.css">
    <link rel="stylesheet" href="/static/css/bootstrap-treeview.css">
    <link rel="stylesheet" href="/static/css/bootstrapValidator.min.css">
    <link rel="stylesheet" href="/static/css/bootstrap-table.min.css">
    <link rel="stylesheet" href="/static/layer/theme/default/layer.css">
    <link rel="stylesheet" href="/static/webCss/daml.css?v=shujubuwqd12138">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="/static/plugins/ie9/html5shiv.min.js"></script>
    <script src="/static/plugins/ie9/respond.min.js"></script>
    <![endif]-->
</head>
<body class="hold-transition skin-blue" style="font-size: medium">

<div class="content row" id="yhgl">
    <div class="modal" id="lxxzModal" data-backdrop="static" >
        <div class="modal-dialog" style="height: 500px">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">选择档案类型</h4>
                </div>
                <div class="modal-body">
                    <div id="lxTree"></div>
                </div>
                <div class="modal-footer">
                    <!--<button type="button" class="btn btn-default pull-left" data-dismiss="modal" @click="close">关闭</button>-->
                    <!--<button @click="sureLxSelect" type="button" class="btn btn-primary">确认选择</button>-->
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>

    <div class="row" style="padding-top: 20px;">
        <div class=" col-xs-4 left row">
            <!--<div class="col-xs-12" style="padding: 0px;padding-top: 20px;padding-bottom: 20px">-->
                <!--<label style="padding-left: 10px">档案快速检索：</label>-->
                <!--<select class="form-control" style="width: 205px;height:32px;margin-left: 10px;margin-right: 20px" v-model="zt" id="selector" @change="kjChange">-->
                    <!--<option :value="kj">科技档案</option>-->
                    <!--<option :value="ws">文书档案</option>-->
                <!--</select>-->
            <!--</div>-->
            <div>
                <div class="dalx">档案类型</div>
            </div>
            <div class="" style="height: 700px;overflow: auto">
                <div id="dalxTree"></div>
            </div>
        </div>
        <div class="col-xs-8 right row">
            <div class="col-xs-12 row" style="margin-top: 30px;margin-bottom: 6px">
                <div class="col-xs-2">
                    <label style="padding-left: 9px">目录详情</label>
                </div>
            </div>
            <div class="col-xs-12 row">
                <div class="col-xs-3" v-show="search2Show" style="display: table;padding-right: 0px;">
                    <input v-model="keyword" type="text" class="form-control" placeholder="输入关键字进行模糊查询" style="margin-left: 4%">
                    <span @click="searchDalx" class="input-group-addon btn  btn-default"><i class="fa fa-search"></i></span>
                </div>
                <div class="col-xs-3" v-show="searchShow" style="display: table">
                    <input v-model="keyword" type="text" class="form-control" placeholder="输入关键字进行模糊查询" style="margin-left: 4%">
                    <span @click="doSearch" class="input-group-addon btn  btn-default"><i class="fa fa-search"></i></span>
                </div>
                <div class="col-xs-1 col-xs-offset-8" v-show="searchShow">
                    <a class="btn cancelBtn" @click="goback" style="margin-left: 50%">返回</a>
                </div>
                <div class="col-xs-1 col-xs-offset-8" v-show="gobackShow">
                    <a class="btn cancelBtn" @click="goback2" style="margin-left: 50%">返回</a>
                </div>
            </div>
            <div class="col-xs-12">
                <div>
                    <div class="box-body" style="height: 650px;overflow: auto">
                        <div v-show="dalxShow">
                            <table class="table table-bordered table-hover text-center" id="dalxTable">

                            </table>
                        </div>
                        <div v-show="xqShow">
                            <table class="table table-bordered table-hover text-center" id="userTable">

                            </table>
                        </div>
                        <div v-show="gryfShow">
                            <table class="table table-bordered table-hover text-center" id="gryfTable">

                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/static/plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="/static/bootstrap/js/bootstrap.min.js"></script>
<!-- Slimscroll -->
<script src="/static/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="/static/plugins/fastclick/fastclick.js"></script>

<!-- AdminLTE App -->
<script src="/static/dist/js/app.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="/static/dist/js/demo.js"></script>
<!--tabs-->
<script src="/static/dist/js/app_iframe.js"></script>
<script src="/static/js/bootstrap-treeview.js"></script>
<script src="/static/js/bootstrapValidator.min.js"></script>
<script src="/static/js/bootstrap-table.min.js"></script>
<script src="/static/js/bootstrap-table-zh-CN.js"></script>
<script src="/static/js/vue.js"></script>
<script src="/static/js/vue-resource.min.js"></script>
<script src="/static/layer/layer.js"></script>
<script src="/static/js/myJs.js?v=shujubuwqd12138"></script>
<script src="/static/dist/js/pages/wJs.js?v=shujubuwqd12138"></script>
<script src="/static/js/newJs.js"></script>
<script type="text/javascript">
    newCss("/static/webCss/daml.css");
    newJs("/static/js/myJs.js");
    newJs("/static/dist/js/pages/wJs.js");
    // createCss("/static/webCss/daml.css");
    var wdlxIds = new Array();

    //生成序号
    function serialNumber(value, row, index) {
        var option = $("#dalxTable").bootstrapTable('getOptions');
        var pageSize = option.pageSize; //获取每页显示的数量
        var pageNumber = option.pageNumber; //获取当前是第几页
        return pageSize * (pageNumber - 1) + index + 1; //返回序号，注意index是从0开始的，所以要加上1
    }

    //查看
    function ck(dalxId,root,dalx){
        vue.$data.gobackShow = false;
        vue.$data.year = dalx;
        vue.$data.dalx = dalxId;
        if(root === "个人用房"){
            vue.$data.isGryf = true;
        }else{
            vue.$data.isGryf = false;
        }
        vue.searchCl2(vue.$data.isGryf);
    }

    window.document.onkeydown = isSearch2;
    function isSearch2(event) {
        var keynum2;
        var keychar;
        var numcheck;

        if(window.event) // IE
        {
            keynum2 = event.keyCode
        } else if(event.which) // Netscape/Firefox/Opera
        {
            keynum2 = event.which
        }
        if(keynum2 === 13){
            if(vue.$data.searchShow){
                vue.doSearch();
            }else {
                vue.searchDalx();
            }
        }
    }
    function paramsMatter(value,row,index) {
        var span=document.createElement('span');
        span.setAttribute('title',value);
        span.innerHTML = value;
        return span.outerHTML;
    }
    //得到treeview层级
    var cj = 1;
    function getCj(data) {
        for(var i = 0 ;i < data.length;i++){
            if(data[i].nodes == null){
                continue;
            }else {
                cj++;
                getCj(data[i].nodes);
            }
        }
        return cj;
        cj = 1;
    }
    //得到父节点数组
    var parentIds = new Array();
    function getParentIds(sonId) {
        var allLx = vue.$data.allLx;
        if(vue.$data.allLx != null){
            for(var i = 0;i < allLx.length;i++){
                if(allLx[i].id == sonId){
                    parentIds.push(allLx[i].parentId);
                    if(allLx[i].parentId == 0){
                        break;
                    }else{
                        getParentIds(allLx[i].parentId);
                    }
                }
            }
        }

        return parentIds;
    }
    //判断节点是否为科技档案
    function isKj(sonId) {
        var pd = true;
        var sonId = sonId;
        var kjdaId;
        var allLx = vue.$data.allLx;
        if(vue.$data.allLx != null){
            var array = getParentIds(sonId);
            for(var j = 0;j < allLx.length;j++){
                if(allLx[j].dalxName == '科技档案'){
                    kjdaId = allLx[j].id;
                    break;
                }
            }
            for(var l = 0;l <array.length;l++){
                if(sonId == kjdaId){
                    pd = true;
                    break;
                }else if(array[l] == kjdaId){
                    pd = true;
                    break;
                }else {
                    pd = false;
                }
            }
        }
        parentIds = [];
        return pd;
    }
    function getid(data) {
        for(var i = 0 ;i < data.length;i++){
            if(data[i].text == "科技档案"){
                vue.$data.dalx == data[i].id;
                break;
            }else {
                getid(data[i].nodes);
            }
        }
    }

    function ck2(dalxId,root,dalx) {
        vue.$data.gobackShow = true;
        vue.$data.root = root;
        vue.$data.dalx = dalxId;
        if(vue.$data.keyword == null){
            var url = '/dalr/api/queryDaxxNf';
        }else {
            var url = '/dalr/api/queryDaxxNf?keyword='+vue.$data.keyword;
        }
        $("#dalxTable").bootstrapTable('destroy');
        $('#dalxTable').bootstrapTable({
            url: url,
            contentType: "application/json; charset=UTF-8",
            type: "GET",
            dataType: 'json',
            queryParamsType: "",
            sortName : 'sxh',
            sortOrder : 'desc',
            singleSelect: true,
            striped: true,
            smartDisplay: false,
            cache: false,
            //pagination:true,  //设置为 true 会在表格底部显示分页条。
            paginationLoop:false, //设置为 true 启用分页条无限循环的功能。
            pageSize:9,//每页初始显示的条数
            pageList:[5,10,20],
            toolbar: "#addtool",
            sidePagination: 'server',
            queryParams: function (params) {
                return {'pageNum':params.pageNumber,'pageSize':params.pageSize,'dalx':vue.$data.dalx,'sort':params.sortOrder};
            },
            columns: [{
                field: 'id',
                title: '序号',
                formatter:serialNumber
            },{
                field: 'root',
                title: '主要类型',
                formatter:paramsMatter
            }, {
                field: 'dalx',
                title: '年份',
                formatter:paramsMatter
            },{
                field: 'number',
                title: '查询结果',
                formatter:paramsMatter
            }
                ,{
                    field: 'cz',
                    title: '操作',
                    formatter: function (value, row, index) {
                        //let sj = {"dabh":row.dabh,"typeId":row.typeId};
                        return '<a style="color: #2C72E8;font-size: 16px" href="javascript:ck('+row.dalxId+',\''+row.root+'\',\''+row.dalx+'\')">查看</a>'
                    }
                }
            ],
            responseHandler: function (res) {  //后台返回的结果
                if (res.code == "200") {
                    var data = res.data;
                    var NewData = [];
                    for(var i=0;i<data.length;i++){
                        NewData.push(data[i]);
                    }
                    var data = {
                        rows: NewData,
                        total:data.total
                    };
                    return data;
                }
            }
        });

    }

    var vue = new Vue({
        el: '#yhgl',
        data: {
            gobackShow:false,//第二个表显示返回按钮
            year:null,//年份
            isGryf:false,//是否是个人用房
            root:null,
            search2Show:true,//档案类型表查询
            searchShow:false,//详细内容查询
            dalxShow:true,//是否展示档案类型表
            xqShow:false,//是否展示详细内容
            gryfShow:false,//展示个人用房表
            zt:null,//文件类型
            kj:null,
            ws:null,
            wdlxName:'科技档案',
            allLx:null,
            keyword:null,
            dalx:null,
            allShy:null
        },
        methods: {
            goback:function(){
                this.gobackShow = true;
                this.gryfShow = false;
                this.xqShow = false;
                this.dalxShow = true;
                this.search2Show = true;
                this.searchShow = false;
            },
            goback2:function(){
                this.gobackShow = false;
                this.searchDalx();
            },
            searchCl2:function(isGryf){
                if(this.keyword == null){
                    url = '/dalr/api/queryDaxx?year='+this.year;
                }else {
                    url = '/dalr/api/queryDaxx?keyword='+this.keyword+'&year='+this.year;
                }
                this.dalxShow = false;
                if(isGryf){
                    this.gryfShow = true;
                    this.xqShow = false;
                    this.searchShow = true;
                    this.search2Show = false;
                    var data;
                    $("#gryfTable").bootstrapTable('destroy');
                    $('#gryfTable').bootstrapTable({
                        url: url,
                        contentType: "application/json; charset=UTF-8",
                        type: "GET",
                        dataType: 'json',
                        queryParamsType: "",
                        sortName : 'sxh',
                        sortOrder : 'desc',
                        singleSelect: true,
                        striped: true,
                        smartDisplay: false,
                        cache: false,
                        pagination:true,  //设置为 true 会在表格底部显示分页条。
                        paginationLoop:false, //设置为 true 启用分页条无限循环的功能。
                        pageSize:10,//每页初始显示的条数
                        pageList:[5,10,20],
                        toolbar: "#addtool",
                        sidePagination: 'server',
                        queryParams: function (params) {
                            return {'pageNum':params.pageNumber,'pageSize':params.pageSize,'dalx':vue.$data.dalx,'sort':params.sortOrder};
                        },
                        columns: [{
                            field: 'id',
                            title: '顺序号',
                            sortable : true,
                            formatter:paramsMatter
                        },{
                            field: 'dabh',
                            title: '档案编号',
                            formatter:paramsMatter
                        }, {
                            field: 'townBsc',
                            title: '镇/办事处',
                            formatter:paramsMatter
                        },{
                            field: 'villageJwh',
                            title: '村/居委会',
                            formatter:paramsMatter
                        }, {
                            field: 'zhh',
                            title: '案卷题名',
                            formatter:paramsMatter
                        }, {
                            field: 'sqcl',
                            title: '申请材料',
                            formatter:paramsMatter
                        }],
                        responseHandler: function (res) {  //后台返回的结果
                            if (res.code == "200") {
                                var data = res.data.data;
                                var NewData = [];
                                for(i=0;i<data.length;i++){
                                    NewData.push(data[i]);
                                }
                                var data = {
                                    rows: NewData,
                                    total:res.data.total
                                };
                                return data;
                            }
                        }
                    });
                }else {
                    this.gryfShow = false;
                    this.xqShow = true;
                    this.searchShow = true;
                    this.search2Show = false;
                    var url;
                    if(vue.$data.root === '科技'){
                        $("#userTable").bootstrapTable('destroy');
                        $('#userTable').bootstrapTable({
                            url: url,
                            contentType: "application/json; charset=UTF-8",
                            type: "GET",
                            dataType: 'json',
                            queryParamsType: "",
                            sortName : 'sxh',
                            sortOrder : 'desc',
                            singleSelect: true,
                            striped: true,
                            smartDisplay: false,
                            cache: false,
                            pagination:true,  //设置为 true 会在表格底部显示分页条。
                            paginationLoop:false, //设置为 true 启用分页条无限循环的功能。
                            pageSize:10,//每页初始显示的条数
                            pageList:[5,10,20],
                            toolbar: "#addtool",
                            sidePagination: 'server',
                            queryParams: function (params) {
                                return {'pageNum':params.pageNumber,'pageSize':params.pageSize,'dalx':vue.$data.dalx,'sort':params.sortOrder};
                            },
                            columns: [{
                                field: 'sxh',
                                title: '顺序号',
                                sortable : true,
                                formatter:paramsMatter
                            },{
                                field: 'dabh',
                                title: '档案编号',
                                formatter:paramsMatter
                            }, {
                                field: 'ajtm',
                                title: '案卷题名',
                                formatter:paramsMatter
                            }, {
                                field: 'year',
                                title: '年份',
                                formatter:paramsMatter
                            }, {
                                field: 'dtslbh',
                                title: '大厅受理编号',
                                formatter:paramsMatter
                            }, {
                                field: 'jsdw',
                                title: '建设单位',
                                formatter:paramsMatter
                            }, {
                                field: 'jswz',
                                title: '建设位置',
                                formatter:paramsMatter
                            }, {
                                field: 'jsgcsgxkzbh',
                                title: '建设工程施工许可证编号',
                                formatter:paramsMatter
                            }, {
                                field: 'daccwz',
                                title: '存储位置',
                                formatter:paramsMatter
                            }
                            ],
                            responseHandler: function (res) {  //后台返回的结果
                                if (res.code == "200") {
                                    var data = res.data.data;
                                    var NewData = [];
                                    for(i=0;i<data.length;i++){
                                        NewData.push(data[i]);
                                    }
                                    var data = {
                                        rows: NewData,
                                        total:res.data.total
                                    };
                                    return data;
                                }
                            }
                        });
                    }else {
                        $("#userTable").bootstrapTable('destroy');
                        $('#userTable').bootstrapTable({
                            url: url,
                            contentType: "application/json; charset=UTF-8",
                            type: "GET",
                            dataType: 'json',
                            queryParamsType: "",
                            sortName : 'id',
                            sortOrder : 'desc',
                            singleSelect: true,
                            striped: true,
                            smartDisplay: false,
                            cache: false,
                            pagination:true,  //设置为 true 会在表格底部显示分页条。
                            paginationLoop:false, //设置为 true 启用分页条无限循环的功能。
                            pageSize:9,//每页初始显示的条数
                            pageList:[5,10,20],
                            toolbar: "#addtool",
                            sidePagination: 'server',
                            queryParams: function (params) {
                                return {'pageNum':params.pageNumber,'pageSize':params.pageSize,'dalx':vue.$data.dalx,'sort':params.sortOrder};
                            },
                            columns: [{
                                field: 'id',
                                title: '顺序号',
                                sortable : true,
                                formatter:paramsMatter
                            },{
                                field: 'dabh',
                                title: '档案号',
                                formatter:paramsMatter
                            },{
                                field: 'typeName',
                                title: '档案类型',
                                formatter:paramsMatter
                            }, {
                                field: 'ajtm',
                                title: '案卷题名',
                                formatter:paramsMatter
                            }, {
                                field: 'wh',
                                title: '文号',
                                formatter:paramsMatter
                            }, {
                                field: 'dwmc',
                                title: '单位名称',
                                formatter:paramsMatter
                            }
                                // ,{
                                //     title: '操作',
                                //     formatter: function (value, row, index) {
                                //         console.log(row)
                                //         var aStr = '<a class="btn-primary btn" href="javascript:dajyrk(\''+row.dabh+'\',\''+row.xmmc+'\',\''+row.typeName+'\',\''+row.typeId+'\')">档案借阅</a>';
                                //         return aStr;
                                //     }
                                // }
                            ],
                            responseHandler: function (res) {  //后台返回的结果
                                if (res.code == "200") {
                                    var data = res.data;
                                    var NewData = [];
                                    for(i=0;i<data.data.length;i++){
                                        NewData.push(data.data[i]);
                                    }
                                    var data = {
                                        rows: NewData,
                                        total:res.data.total
                                    };
                                    return data;
                                }
                            }
                        });
                    }
                }
            },
            searchCl:function(id){
                vue.$data.dalx = id;
                if(isKj(vue.$data.dalx)){
                    $("#userTable").bootstrapTable('destroy');
                    $('#userTable').bootstrapTable({
                        url: '/dalr/api/queryDaxx',
                        contentType: "application/json; charset=UTF-8",
                        type: "GET",
                        dataType: 'json',
                        queryParamsType: "",
                        sortName : 'sxh',
                        sortOrder : 'desc',
                        singleSelect: true,
                        striped: true,
                        smartDisplay: false,
                        cache: false,
                        pagination:true,  //设置为 true 会在表格底部显示分页条。
                        paginationLoop:false, //设置为 true 启用分页条无限循环的功能。
                        pageSize:9,//每页初始显示的条数
                        pageList:[5,10,20],
                        toolbar: "#addtool",
                        sidePagination: 'server',
                        queryParams: function (params) {
                            return {'pageNum':params.pageNumber,'pageSize':params.pageSize,'dalx':vue.$data.dalx,'sort':params.sortOrder};
                        },
                        columns: [{
                            field: 'sxh',
                            title: '顺序号',
                            sortable : true,
                            formatter:paramsMatter
                        },{
                            field: 'dabh',
                            title: '档案编号',
                            formatter:paramsMatter
                        }, {
                            field: 'ajtm',
                            title: '案卷题名',
                            formatter:paramsMatter
                        }, {
                            field: 'year',
                            title: '年份',
                            formatter:paramsMatter
                        }, {
                            field: 'dtslbh',
                            title: '大厅受理编号',
                            formatter:paramsMatter
                        }, {
                            field: 'jsdw',
                            title: '建设单位',
                            formatter:paramsMatter
                        }, {
                            field: 'jswz',
                            title: '建设位置',
                            formatter:paramsMatter
                        }, {
                            field: 'jsgcsgxkzbh',
                            title: '建设工程施工许可证编号',
                            formatter:paramsMatter
                        }, {
                            field: 'daccwz',
                            title: '存储位置',
                            formatter:paramsMatter
                        }
                        ],
                        responseHandler: function (res) {  //后台返回的结果
                            if (res.code == "200") {
                                var data = res.data;
                                var NewData = [];
                                for(i=0;i<data.data.length;i++){
                                    NewData.push(data.data[i]);
                                }
                                var data = {
                                    rows: NewData,
                                    total:data.total
                                };
                                return data;
                            }
                        }
                    });
                }else {
                    $("#userTable").bootstrapTable('destroy');
                    $('#userTable').bootstrapTable({
                        url: '/dalr/api/queryDaxx',
                        contentType: "application/json; charset=UTF-8",
                        type: "GET",
                        dataType: 'json',
                        queryParamsType: "",
                        sortName : 'id',
                        sortOrder : 'desc',
                        singleSelect: true,
                        striped: true,
                        smartDisplay: false,
                        cache: false,
                        pagination:true,  //设置为 true 会在表格底部显示分页条。
                        paginationLoop:false, //设置为 true 启用分页条无限循环的功能。
                        pageSize:9,//每页初始显示的条数
                        pageList:[5,10,20],
                        toolbar: "#addtool",
                        sidePagination: 'server',
                        queryParams: function (params) {
                            return {'pageNum':params.pageNumber,'pageSize':params.pageSize,'dalx':vue.$data.dalx,'sort':params.sortOrder};
                        },
                        columns: [{
                            field: 'id',
                            title: '顺序号',
                            sortable : true,
                            formatter:paramsMatter
                        },{
                            field: 'dabh',
                            title: '档案号',
                            formatter:paramsMatter
                        },{
                            field: 'typeName',
                            title: '档案类型',
                            formatter:paramsMatter
                        }, {
                            field: 'ajtm',
                            title: '案卷题名',
                            formatter:paramsMatter
                        }, {
                            field: 'wh',
                            title: '文号',
                            formatter:paramsMatter
                        }, {
                            field: 'dwmc',
                            title: '单位名称',
                            formatter:paramsMatter
                        }
                            // ,{
                            //     title: '操作',
                            //     formatter: function (value, row, index) {
                            //         console.log(row)
                            //         var aStr = '<a class="btn-primary btn" href="javascript:dajyrk(\''+row.dabh+'\',\''+row.xmmc+'\',\''+row.typeName+'\',\''+row.typeId+'\')">档案借阅</a>';
                            //         return aStr;
                            //     }
                            // }
                        ],
                        responseHandler: function (res) {  //后台返回的结果
                            if (res.code == "200") {
                                var data = res.data.data;
                                var NewData = [];
                                for(i=0;i<data.data.length;i++){
                                    NewData.push(data.data[i]);
                                }
                                var data = {
                                    rows: NewData,
                                    total:data.total
                                };
                                return data;
                            }
                        }
                    });
                }
            },
            //大类型表格查询
            searchDalx:function () {
                if(this.keyword == null){
                    $("#dalxTable").bootstrapTable('destroy');
                    $('#dalxTable').bootstrapTable({
                        url: '/dajsOuterCx?wdlx='+wdlxIds,
                        contentType: "application/json; charset=UTF-8",
                        type: "GET",
                        dataType: 'json',
                        queryParamsType: "",
                        singleSelect: true,
                        striped: true,
                        smartDisplay: false,
                        cache: false,
                        //pagination:true,  //设置为 true 会在表格底部显示分页条。
                        paginationLoop:false, //设置为 true 启用分页条无限循环的功能。
                        pageSize:9,//每页初始显示的条数
                        pageList:[5,10],
                        toolbar: "#addtool",
                        sidePagination: 'server',
                        queryParams: function (params) {
                            return {
                                'pageNum':params.pageNumber,
                                'pageSize':params.pageSize,
                            };
                        },
                        columns: [{
                            field: 'id',
                            title: '序号',
                            formatter:serialNumber
                        },{
                            field: 'root',
                            title: '主要类型',
                            formatter:paramsMatter
                        }, {
                            field: 'dalx',
                            title: '详细类型',
                            formatter:paramsMatter
                        },{
                            field: 'number',
                            title: '查询结果',
                            formatter:paramsMatter
                        }
                            ,{
                                field: 'cz',
                                title: '操作',
                                formatter: function (value, row, index) {
                                    //let sj = {"dabh":row.dabh,"typeId":row.typeId};
                                    return '<a style="color: #2C72E8;font-size: 16px" href="javascript:ck2('+row.dalxId+',\''+row.root+'\',\''+row.dalx+'\')">查看</a>'
                                }
                            }
                        ],
                        responseHandler: function (res) {  //后台返回的结果
                            if (res.code == "200") {
                                var data = res.data;
                                var NewData = [];
                                for(var i=0;i<data.length;i++){
                                    NewData.push(data[i]);
                                }
                                var data = {
                                    rows: NewData,
                                    total:data.total
                                };
                                return data;
                            }
                        }
                    });
                }else {
                    $("#dalxTable").bootstrapTable('destroy');
                    $('#dalxTable').bootstrapTable({
                        url: '/dajsOuterCx?wdlx='+wdlxIds+'&keyword='+this.keyword,
                        contentType: "application/json; charset=UTF-8",
                        type: "GET",
                        dataType: 'json',
                        queryParamsType: "",
                        singleSelect: true,
                        striped: true,
                        smartDisplay: false,
                        cache: false,
                        //pagination:true,  //设置为 true 会在表格底部显示分页条。
                        paginationLoop:false, //设置为 true 启用分页条无限循环的功能。
                        pageSize:9,//每页初始显示的条数
                        pageList:[5,10],
                        toolbar: "#addtool",
                        sidePagination: 'server',
                        queryParams: function (params) {
                            return {
                                'pageNum':params.pageNumber,
                                'pageSize':params.pageSize,
                            };
                        },
                        columns: [{
                            field: 'id',
                            title: '序号',
                            formatter:serialNumber
                        },{
                            field: 'root',
                            title: '主要类型',
                            formatter:paramsMatter
                        }, {
                            field: 'dalx',
                            title: '详细类型',
                            formatter:paramsMatter
                        },{
                            field: 'number',
                            title: '查询结果',
                            formatter:paramsMatter
                        }
                            ,{
                                field: 'cz',
                                title: '操作',
                                formatter: function (value, row, index) {
                                    //let sj = {"dabh":row.dabh,"typeId":row.typeId};
                                    return '<a style="color: #2C72E8;font-size: 16px" href="javascript:ck2('+row.dalxId+',\''+row.root+'\',\''+row.dalx+'\')">查看</a>'
                                }
                            }
                        ],
                        responseHandler: function (res) {  //后台返回的结果
                            if (res.code == "200") {
                                var data = res.data;
                                var NewData = [];
                                for(var i=0;i<data.length;i++){
                                    NewData.push(data[i]);
                                }
                                var data = {
                                    rows: NewData,
                                    total:data.total
                                };
                                return data;
                            }
                        }
                    });
                }
            },
            doSearch:function(){
                this.searchCl2(this.isGryf);
            },
        },
        created: function () {
            this.$http.get('/dagl/api/queryDalx').then( function (result) {
                var data = result.body;
                if(data.code == 200){
                    getid(data.data);
                }
            })
            this.$http.get('/listShUser').then( function (result) {
                var data = result.body;
                if(data.code == 200){
                    this.allShy = data.data;
                }else{
                    cxAlert(data.mess);
                }
            })
        },
        mounted: function () {
            var that = this;
            $("#dalxTable").bootstrapTable('destroy');
            $('#dalxTable').bootstrapTable({
                url: '',
                contentType: "application/json; charset=UTF-8",
                type: "GET",
                dataType: 'json',
                queryParamsType: "",
                singleSelect: true,
                striped: true,
                smartDisplay: false,
                cache: false,
                //pagination:true,  //设置为 true 会在表格底部显示分页条。
                paginationLoop:false, //设置为 true 启用分页条无限循环的功能。
                pageSize:9,//每页初始显示的条数
                pageList:[5,10],
                toolbar: "#addtool",
                sidePagination: 'server',
                queryParams: function (params) {
                    return {
                        'pageNum':params.pageNumber,
                        'pageSize':params.pageSize,
                    };
                },
                columns: [{
                    field: 'id',
                    title: '序号',
                    formatter:serialNumber
                },{
                    field: 'root',
                    title: '主要类型',
                    formatter:paramsMatter
                }, {
                    field: 'dalx',
                    title: '详细类型',
                    formatter:paramsMatter
                },{
                    field: 'number',
                    title: '查询结果',
                    formatter:paramsMatter
                }
                    ,{
                        field: 'cz',
                        title: '操作',
                        formatter: function (value, row, index) {
                            //let sj = {"dabh":row.dabh,"typeId":row.typeId};
                            return '<a style="color: #2C72E8;font-size: 16px" href="javascript:ck2('+row.dalxId+',\''+row.root+'\',\''+row.dalx+'\')">查看</a>'
                        }
                    }
                ],
                responseHandler: function (res) {  //后台返回的结果
                    if (res.code == "200") {
                        var data = res.data;
                        var NewData = [];
                        var data = {
                            rows: NewData,
                            total:data.total
                        };
                        return data;
                    }
                }
            });
            this.$http.get('/dagl/api/queryDalx').then( function (result) {
                var data = result.body;
                if(data.code == 200){
                    var cj = getCj(data.data);
                    getkjAndws(data.data);
                    that.zt = that.kj;
                    var nodes = data.data[0].nodes;
                    $('#dalxTree').treeview({
                        color: "#428bca",
                        collapseIcon: "glyphicon glyphicon-minus",//可收缩的节点图标
                        // nodeIcon: "glyphicon glyphicon-user",
                        emptyIcon: "glyphicon glyphicon-file",//设置列表树中没有子节点的节点的图标
                        expandIcon: "glyphicon glyphicon-plus",  //设置列表上中有子节点的图标
                        highlightSearchResults:true,//是否高亮搜索结果 默认true
                        highlightSelected:false,     //是否选中高亮显示
                        onhoverColor: "#f5f5f5",    //鼠标滑过的颜色
                        levels: cj,                 //设置初始化展开几级菜单 默认为2
                        //selectedIcon: 'glyphicon glyphicon-tint',
                        showBorder:true,                //是否显示边框
                        showCheckbox:true,              //是否显示多选框
                        data:nodes,
                        showTags:true,
                        onNodeSelected:function(event, data) {
                            $('#dalxTree').treeview('checkNode', data.nodeId, {
                                silent: true
                            });
                            // var isCheck = false;
                            // for(var i = 0;i <wdlxIds.length;i++){
                            //     if(wdlxIds[i] === data.id){
                            //         isCheck = true;
                            //         break;
                            //     }
                            // }
                            // if(isCheck){
                            //     $('#dalxTree').treeview('uncheckNode', data.nodeId, {
                            //         silent: true
                            //     });
                            // }else {
                            //
                            // }
                        },
                        onNodeChecked: function (event,node) {
                            var id = node.id;
                            var kjNodes = nodes[0];
                            var kjId = kjNodes.id;
                            var wsNodes = nodes[1];
                            var wsId = wsNodes.id;
                            for(var j = 0;j <kjNodes.nodes.length;j++){
                                if(kjNodes.nodes[j].id === id){
                                    for(var k = 0;k <wdlxIds.length;k++){
                                        if(kjId === wdlxIds[k]){
                                            wdlxIds.splice(k,1);
                                            break;
                                        }
                                    }
                                    $('#dalxTree').treeview('uncheckNode', 0, {
                                        silent: true
                                    });
                                    break;
                                }
                            }
                            for(var m = 0;m <wsNodes.nodes.length;m++){
                                if(wsNodes.nodes[m].id === id){
                                    for(var n = 0;n <wdlxIds.length;n++){
                                        if(wsId === wdlxIds[n]){
                                            wdlxIds.splice(n,1);
                                            break;
                                        }
                                    }
                                    $('#dalxTree').treeview('uncheckNode', 6, {
                                        silent: true
                                    });
                                    break;
                                }
                            }
                            wdlxIds.push(id);
                            if(that.dalxShow){
                                that.searchDalx();
                            }else {
                                that.searchCl(id);
                            }
                        },
                        onNodeUnchecked: function (event,node) {
                            var text = node.text;
                            var id = node.id;
                            for(var i = 0;i <wdlxIds.length;i++){
                                if(id === wdlxIds[i]){
                                    wdlxIds.splice(i,1);
                                    break;
                                }
                            }
                            if(that.dalxShow){
                                if(!(text === "科技档案" || text === "文书档案")){
                                    that.searchDalx();
                                }
                            }else {
                                that.searchCl(id);
                            }
                        },
                    });
                }else{
                    cxAlert(data.mess);
                }
            })

        }
    });


</script>
</body>
</html>
